import api from "@/api/apiServer.js";

const equipmentColumns = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    customRender: (text, record, index) => `${index + 1}`,
    align: "center",
  },
  {
    title: "设备编号",
    dataIndex: "equipmentNumber",
    key: "equipmentNumber",
    align: "center",
  },
  {
    title: "设备名称",
    dataIndex: "equipmentName",
    key: "equipmentName",
    align: "center",
  },
  {
    title: "设备型号",
    dataIndex: "equipmentModel",
    key: "equipmentModel",
    align: "center",
  },
];

const lineColumns = [
  {
    title: "序号",
    dataIndex: "index",
    key: "index",
    customRender: (text, record, index) => `${index + 1}`,
    align: "center",
  },
  {
    title: "产线名称",
    dataIndex: "name",
    key: "name",
    align: "center",
  },
  {
    title: "机床",
    dataIndex: "equipNums",
    key: "equipNums",
    align: "center",
  },
];

// 选择设备
const equipmentModel = {
  treeKey: "equipmentTypeList",
  tableKey: "equipmentListPage",
  searchKey: "equipmentType",
  name: "equipmentName",
  code: "equipmentNumber",
  filename: "EquipMentModal",
  columns: equipmentColumns,
  mode: "checkbox",
  deletekey:"equipmentDelete",
  tableOption: [],
};

const linModel = {
  columns: equipmentColumns,
  tableKey: "ProductLinePage",
  searchKey: "equipmentType",
  name: "name",
  code: "serialNumber",
  filename: "EquipMentModal",
  columns: lineColumns,
  deletekey:"DeleteProductLine",
  tableOption: [],
};
// 数据查询参数
let params = { pageNumber: 1, pageSize: 99999, deleteFlag: "N" };
// 获取责任人数据源
// async function getUser() {
//   const res = await api.UserList(params);
//   userModel.tableOption = res.data.data;
// }
// 获取设备数据源
async function getEquipment() {
  const res = await api.equipmentListPage(params);
  equipmentModel.tableOption = res.data.data;
}
// getUser();
getEquipment();

export { equipmentModel,linModel };
